Don't make "smart" (typ. geocaching) names the default. -N now silently eaten. Add -S.
authorrobertl <robertl>
Fri, 16 Feb 2007 00:31:48 +0000 (00:31 +0000)
committerrobertl <robertl>
Fri, 16 Feb 2007 00:31:48 +0000 (00:31 +0000)
defs.h
garmin.c
kml.c
magproto.c
main.c
util.c

diff --git a/defs.h b/defs.h
index 8262323ea8e78f647f5c333a364b697be744002c..0c8e081a5e51c3118b4abf10d37d19c7a18192d8 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -151,8 +151,8 @@ typedef struct {
        gpsdata_type objective;
        unsigned int    masked_objective;
        int verbose_status;     /* set by GUI wrappers for status */
-       int no_smart_icons;     
-       int no_smart_names;
+       int smart_icons;        
+       int smart_names;
        cet_cs_vec_t *charset;
        char *charset_name;
        inifile_t *inifile;
index f43b5a18fab6a37b5da72d5ed50397692151cced..69d906a4097280a68dd9f215aabe22c361a42245 100644 (file)
--- a/garmin.c
+++ b/garmin.c
@@ -572,13 +572,13 @@ waypt_write_cb(GPS_PWay *way)
 }
 
 /* 
- * If we're not using smart icons, try to put the cache info in the
+ * If we're using smart names, try to put the cache info in the
  * description.
  */
 const char *
 get_gc_info(waypoint *wpt)
 {
-       if (global_opts.no_smart_icons) {
+       if (global_opts.smart_names) {
                if (wpt->gc_data.type == gt_virtual) return  "V ";
                if (wpt->gc_data.type == gt_unknown) return  "? ";
                if (wpt->gc_data.type == gt_multi) return  "Mlt ";
@@ -636,7 +636,7 @@ waypoint_write(void)
                }
                way[i]->ident[sizeof(way[i]->ident)-1] = 0;
 
-               if (!global_opts.no_smart_icons && 
+               if (global_opts.smart_names && 
                     wpt->gc_data.diff && wpt->gc_data.terr) {
                        snprintf(obuf, sizeof(obuf), "%s%d/%d %s", 
                                        get_gc_info(wpt),
diff --git a/kml.c b/kml.c
index 34c96ffb2a47c75acb3d1e05a4c8dd18ef7a9fc6..c544a041f6e0f814ae8da556d3ebdf801c8d4710 100644 (file)
--- a/kml.c
+++ b/kml.c
@@ -676,8 +676,13 @@ static void kml_waypt_pr(const waypoint *waypointp)
                else
                        fputs(odesc, ofd);
 
-               if (!global_opts.no_smart_icons && 
-                    waypointp->gc_data.diff && waypointp->gc_data.terr) {
+               /* It's tempting to conditionalize this on smart_names, but
+                * KML is so robust that it makes sense to just always do
+                * this for geocaches.  (Plus the convenience of being able
+                * to do a drag-n-drop into Earth without extra option is a 
+                * win.)
+                */
+               if (waypointp->gc_data.diff && waypointp->gc_data.terr) {
                        if (waypointp->gc_data.placer) {
                                char *p = xml_entitize(waypointp->gc_data.placer);
                                fprintf(ofd, "<![CDATA[<i> by %s</i>]]>", p);
@@ -713,7 +718,7 @@ static void kml_waypt_pr(const waypoint *waypointp)
                kml_write_xml(-1, "</IconStyle>\n");
                kml_write_xml(-1, "</Style>\n");
 
-       } else if (!global_opts.no_smart_icons && waypointp->gc_data.diff && waypointp->gc_data.terr) {
+       } else if (waypointp->gc_data.diff && waypointp->gc_data.terr) {
                char *is = kml_lookup_gc_icon(waypointp);
                kml_write_xml(1, "<Style>\n");
                kml_write_xml(1, "<IconStyle>\n");
index 44c704888df28e334668a8b3125a33de29460ffb..ee763d4880c39f1ac5a1f7fd43293f322401a48e 100644 (file)
@@ -1254,7 +1254,7 @@ mag_waypt_pr(const waypoint *waypointp)
        odesc = isrc ? isrc : "";
        owpt = mag_cleanse(owpt);
 
-       if (!global_opts.no_smart_icons &&
+       if (global_opts.smart_icons &&
            waypointp->gc_data.diff && waypointp->gc_data.terr) {
                sprintf(ofmtdesc, "%d/%d %s", waypointp->gc_data.diff, 
                        waypointp->gc_data.terr, odesc);
diff --git a/main.c b/main.c
index 3051c5b9fa7d2c90db31fd653cc21df5d3ce1c80..6c1aabfb39efd741f8ea4948439126dd17208e9c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -426,6 +426,12 @@ main(int argc, char *argv[])
                                global_opts.masked_objective |= POSNDATAMASK;
                                break;
                        case 'N':
+#if 0
+/* This option is silently eaten for compatibilty.  -N is now the
+ * default.  If you want the old behaviour, -S allows you to individually
+ * turn them on.  The -N option will be removed in 2008.
+ */ 
+
                                switch(argv[argn][2]) {
                                        case 'i':
                                                global_opts.no_smart_icons = 1;
@@ -438,7 +444,22 @@ main(int argc, char *argv[])
                                                global_opts.no_smart_icons = 1;
                                                break;
                                }
+#endif
                                
+                               break;
+                       case 'S':
+                               switch(argv[argn][2]) {
+                                       case 'i':
+                                               global_opts.smart_icons = 1;
+                                               break;  
+                                       case 'n': 
+                                               global_opts.smart_names = 1;
+                                               break;
+                                       default:
+                                               global_opts.smart_icons = 1;
+                                               global_opts.smart_names = 1;
+                                               break;
+                               }
                                break;
                        case 'x':
                                optarg = argv[argn][2]
diff --git a/util.c b/util.c
index c0debfcc864cd4e53e84eb24961067bf5675421f..1af7d25e629c4d83ad9b1a0de8cdbab63e228adf 100644 (file)
--- a/util.c
+++ b/util.c
@@ -839,7 +839,7 @@ month_lookup(const char *m)
 const char *
 get_cache_icon(const waypoint *waypointp)
 {
-       if (global_opts.no_smart_icons)
+       if (!global_opts.smart_icons)
                return NULL;
 
        /*